package com.example.renhao.widget_14120200320renhao;

import android.content.DialogInterface;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    Button button;
    EditText editText;
    TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       // button=(button)findViewById(R.id.button4);
        editText=(EditText) findViewById(R.id.editText2);
        textView=(TextView) findViewById(R.id.button4);

        button.setOnClickListener(this);
    }
        public void onClick(View v) {
            String text=editText.getText().toString();
            textView.setText(text);
            Toast.makeText(MainActivity.this,"button is clicked",Toast.LENGTH_SHORT).show();

    }
    }

